﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HZ.DrugTrade.IBLL;
using HZ.DrugTrade.BLLFactory;
using HZ.DrugTrade.Model;
using System.Data;
using HZ.DrugTrade.Model.Enum;
namespace HZ.DrugTrade.Web.Admin.RelationQuery
{
    public partial class CompanyDelLog :BasePage
    {
        public CompanyDelLog()
        {
            this.ModuleNo = Module.查看不良记录.ToString();
        }
        IBLL_ProcurementBasic ipb = Factory.BLL_ProcurementBasic();
        IBLL_AreaDistributionDelLog iselectRelation = Factory.BLL_AreaDistributionDelLog();

        string procureCatalogId = "";

        protected void Page_Load(object sender, EventArgs e)
        {

            if (!IsPostBack)
            {

                Banding();//绑定
            }
        }
        public HZ.DrugTrade.Model.Query.Company GetWhere()
        {
            HZ.DrugTrade.Model.Query.Company where = new HZ.DrugTrade.Model.Query.Company();

            where.CompanyID = txtCompanyID.Text.Trim();
            where.CompanyName = txtCompanyName.Text.Trim();
            switch (DllType.SelectedItem.Value.Trim())
            {

                case "0":
                    where.Append = "CompanyType = 0";
                    break;

                case "1":
                    where.Append = "CompanyType = 1";
                    break;

                case "2":
                    where.Append = "CompanyType = 2";
                    break;
                default: break;
            }
            return where;
        }
        /// <summary>
        /// 绑定
        /// </summary>
        private void Banding()
        {
            int totalCount = 0;
            AspNetPager1.PageSize = Constants.GRIDVIEW_PAGE_SIZE;
            DataTable dt = iselectRelation.GetCompanyDelLog(GetWhere(), AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, out totalCount);
            gvwProduceCatalog.DataSource = dt;
            gvwProduceCatalog.DataBind();
            AspNetPager1.RecordCount = totalCount;
        }
        protected void AspNetPager1_OnPageChanged(object sender, EventArgs e)
        {
            Banding();
        }

        protected void btnSelect_Click(object sender, EventArgs e)
        {
            this.AspNetPager1.CurrentPageIndex = 1;
            Banding();
        }

        protected void btnExport_Click(object sender, EventArgs e)
        {
            int totalCount=0;
           HZ.Excel.ExcelHelper.ExportDataForWeb(iselectRelation.GetCompanyDelLog(GetWhere(), 1, 0,out totalCount), gvwProduceCatalog);
        }
     
      

    

    }
}
